import 'package:flutter/material.dart';
import 'package:study/tabs/Tabs.dart';

class LoginPage extends StatefulWidget {
  @override
  _LoginPageState createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {

  var leftRightPadding = 30.0;
  var topBottomPadding = 4.0;
  var textTips =  TextStyle(fontSize: 16.0, color: Colors.black);
  var hintTips =  TextStyle(fontSize: 15.0, color: Colors.black26);

  var _userPassController =  TextEditingController();
  var _userNameController =  TextEditingController();

  @override
  Widget build(BuildContext context) {
    return  Scaffold(
        appBar:  AppBar(
          title:  Text("登录", style:  TextStyle(color: Colors.white)),
          iconTheme: new IconThemeData(color: Colors.white),
        ),
        body:  Column(
          mainAxisSize: MainAxisSize.max,
          mainAxisAlignment: MainAxisAlignment.start,
          children: <Widget>[
             Padding(
              padding:  EdgeInsets.fromLTRB(
                  leftRightPadding, 50.0, leftRightPadding, 10.0),
              child:  Image.network("http://pics.sc.chinaz.com/Files/pic/faces/2337/1.gif"),
            ),
             Padding(
              padding:  EdgeInsets.fromLTRB(
                  leftRightPadding, 50.0, leftRightPadding, topBottomPadding),
              child:  TextField(
                style: hintTips,
                controller: _userNameController,
                decoration:  InputDecoration(hintText: "请输入用户名"),
                obscureText: false,
              ),
            ),
             Padding(
              padding:  EdgeInsets.fromLTRB(
                  leftRightPadding, 30.0, leftRightPadding, topBottomPadding),
              child:  TextField(
                style: hintTips,
                controller: _userPassController,
                decoration:  InputDecoration(hintText: "请输入用户密码"),
                obscureText: true,
              ),
            ),
             Container(
              width: 360.0,
              margin:  EdgeInsets.fromLTRB(10.0, 40.0, 10.0, 0.0),
              padding:  EdgeInsets.fromLTRB(leftRightPadding,
                  topBottomPadding, leftRightPadding, topBottomPadding),
              child:  Card(
                color: Colors.green,
                elevation: 6.0,
                child:  FlatButton(
                    onPressed: () {
                      print("the pass is" + _userNameController.text);
                      Navigator.of(context).pop();

                    },
                    child:  Padding(
                      padding:  EdgeInsets.all(10.0),
                      child:  Text(
                        '马上登录',
                        style:
                         TextStyle(color: Colors.white, fontSize: 16.0),
                      ),
                    )),
              ),

            )
          ],
        ));
  }
}
